﻿using System;
using System.Linq;

class LeastMajorityMultiple
{
    static void Main()
    {
        int[] numbers = new int[5];
        for (int i = 0; i < numbers.Length; i++)
        {
            numbers[i] = int.Parse(Console.ReadLine());
        }
        Array.Sort(numbers);
        int leastMajority = numbers[2];
        int result = 0;
        while (result < 3)
        {
            result = 0;
            foreach (int num in numbers)
            {
                if (leastMajority % num == 0)
                {
                    result++;
                }
            }
            leastMajority++;
        }
        Console.WriteLine(leastMajority - 1);
    }
}